package com.cmpan.networkdisk.config;

import com.cmpan.networkdisk.interceptor.MyInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * ClassName:WebConfig
 * Package:com.cmpan.networkdisk.config
 * Description:
 *
 * @Date:2020/7/6 21:03
 * @com.chuangmei
 */
@Configuration
public class WebConfig implements WebMvcConfigurer {

    @Override
    public void addInterceptors(InterceptorRegistry registry) {

        //拦截的请求
        String addPath[] = {"/user/*","/goDisk","/disk/*","/admin/*","/admindisk/*","/dynamic/input"};

        //不拦截请求
        String excludePath[] = {"/user/login"};

        registry.addInterceptor(new MyInterceptor()).addPathPatterns(addPath).excludePathPatterns(excludePath);
    }
}
